-
Notifications
You must be signed in to change notification settings - Fork 15.2k
RuntimeLibcalls: Add small_printf functions to emscripten #167087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
arsenm
wants to merge
1
commit into
users/arsenm/runtime-libcalls/add-unlocked-io-funcs-macos
Choose a base branch
from
users/arsenm/runtime-libcalls/add-small-printf-emscripten
base: users/arsenm/runtime-libcalls/add-unlocked-io-funcs-macos
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
RuntimeLibcalls: Add small_printf functions to emscripten #167087
arsenm
wants to merge
1
commit into
users/arsenm/runtime-libcalls/add-unlocked-io-funcs-macos
from
users/arsenm/runtime-libcalls/add-small-printf-emscripten
+10
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Nov 8, 2025
This was referenced Nov 8, 2025
This was referenced Nov 8, 2025
Contributor
Author
This was referenced Nov 8, 2025
Member
|
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-llvm-selectiondag Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/167087.diff 2 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index dd06a3442cebb..ad11216c6ee9d 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -3457,6 +3457,7 @@ def SystemZZOSSystemLibrary
def emscripten_return_address : RuntimeLibcallImpl<RETURN_ADDRESS>;
def isWasm : RuntimeLibcallPredicate<"TT.isWasm()">;
+def isOSEmscripten : RuntimeLibcallPredicate<[{TT.isOSEmscripten()}]>;
// Define the emscripten name for return address helper.
// TODO: when implementing other Wasm backends, make this generic or only do
@@ -3468,6 +3469,9 @@ def WasmSystemLibrary
exp10f, exp10,
_Unwind_CallPersonality,
emscripten_return_address,
+ LibcallImpls<(add __small_printf,
+ __small_sprintf,
+ __small_fprintf), isOSEmscripten>,
__stack_chk_fail, __stack_chk_guard)>;
//===----------------------------------------------------------------------===//
diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll
new file mode 100644
index 0000000000000..f92f0fe2a189f
--- /dev/null
+++ b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll
@@ -0,0 +1,6 @@
+; REQUIRES: webassembly-registered-target
+; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=wasm64-unknown-emscripten < %s | FileCheck %s
+
+; CHECK: declare void @__small_fprintf(...)
+; CHECK: declare void @__small_printf(...)
+; CHECK: declare void @__small_sprintf(...)
|
Member
|
@llvm/pr-subscribers-llvm-ir Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/167087.diff 2 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index dd06a3442cebb..ad11216c6ee9d 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -3457,6 +3457,7 @@ def SystemZZOSSystemLibrary
def emscripten_return_address : RuntimeLibcallImpl<RETURN_ADDRESS>;
def isWasm : RuntimeLibcallPredicate<"TT.isWasm()">;
+def isOSEmscripten : RuntimeLibcallPredicate<[{TT.isOSEmscripten()}]>;
// Define the emscripten name for return address helper.
// TODO: when implementing other Wasm backends, make this generic or only do
@@ -3468,6 +3469,9 @@ def WasmSystemLibrary
exp10f, exp10,
_Unwind_CallPersonality,
emscripten_return_address,
+ LibcallImpls<(add __small_printf,
+ __small_sprintf,
+ __small_fprintf), isOSEmscripten>,
__stack_chk_fail, __stack_chk_guard)>;
//===----------------------------------------------------------------------===//
diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll
new file mode 100644
index 0000000000000..f92f0fe2a189f
--- /dev/null
+++ b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/emscripten.ll
@@ -0,0 +1,6 @@
+; REQUIRES: webassembly-registered-target
+; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=wasm64-unknown-emscripten < %s | FileCheck %s
+
+; CHECK: declare void @__small_fprintf(...)
+; CHECK: declare void @__small_printf(...)
+; CHECK: declare void @__small_sprintf(...)
|
b54d80c to
f0a641e
Compare
6656c92 to
b01305a
Compare
RKSimon
approved these changes
Nov 10, 2025
b01305a to
2a92356
Compare
f0a641e to
0f391f4
Compare
2a92356 to
dfee74d
Compare
0f391f4 to
2eee7b2
Compare
dfee74d to
87e1210
Compare
2eee7b2 to
a67707c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

No description provided.